package org.example.pack1023.reflect;

import java.lang.reflect.Field;
import java.util.Arrays;

public class DemoC {
    public static void main(String[] args) throws  Exception {
        Class c = Class.forName("org.example.pack1023.reflect.ChildClass");
        //获取属性
        Field[] fields1 = c.getFields();
        Field[] fields2 = c.getDeclaredFields();
        System.out.println(Arrays.toString(fields1));
        System.out.println(Arrays.toString(fields2));

        Field field1 = c.getField("b");
        Field field2 = c.getDeclaredField("c");
        System.out.println(field1);
        System.out.println(field2);
    }
}
